package com.zzyl.nursing.controller.member;

import com.zzyl.common.core.controller.BaseController;
import com.zzyl.common.core.domain.R;
import com.zzyl.common.utils.UserThreadLocal;
import com.zzyl.nursing.dto.UserLoginRequestDto;
import com.zzyl.nursing.service.IFamilyMemberService;
import com.zzyl.nursing.vo.LoginVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 老人家属Controller
 *
 * @author FuJiaWei
 * @date 2025-05-29
 */
@RestController
@RequestMapping("/member/user")
@Api(tags = "老人家属相关接口")
public class FamilyMemberController extends BaseController {
    @Autowired
    private IFamilyMemberService familyMemberService;

    /**
     * 小程序登入
     *
     * @param userLoginRequestDto
     * @return
     */
    @PostMapping("/login")
    @ApiOperation("小程序登入")
    public R<LoginVo> login(@RequestBody UserLoginRequestDto userLoginRequestDto) {
        LoginVo loginVo = familyMemberService.login(userLoginRequestDto);
        return R.ok(loginVo);
    }


    /**
     * 预约信息Controller
     *
     * @author ruoyi
     */
    @RestController
    @RequestMapping("/member/reservation")
    @Api(tags = "预约信息相关接口")
    public class MemberReservationController extends BaseController {
        @GetMapping("/cancelled-count")
        @ApiOperation("查询取消预约数量")
        public R<Integer> getCancelledReservationCount() {
            Long userId = UserThreadLocal.getUserId();
            System.out.println("------" + userId);
            return R.ok(1);
        }
    }
}
